package com.cy.config;

import com.cy.controller.interceptor.DataInterceptor;
import com.cy.controller.interceptor.LoginRequiredInterceptor;
import com.cy.controller.interceptor.LoginTicketInterceptor;
import com.cy.controller.interceptor.MessageIntercepter;
import com.cy.service.LoginTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author: cy
 * @Date: 2022/01/02/18:42
 * @Description:
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private LoginTicketInterceptor loginTicketInterceptor;

//    @Resource
//    private LoginRequiredInterceptor loginRequiredInterceptor;

    @Resource
    private MessageIntercepter messageIntercepter;

    @Autowired
    private DataInterceptor dataInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginTicketInterceptor)
                .excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.pg", "/**/*.jpeg");   //不拦截的请求


//        registry.addInterceptor(loginRequiredInterceptor)
//                .excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.pg", "/**/*.jpeg");   //不拦截的请求

        registry.addInterceptor(messageIntercepter)
                .excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.pg", "/**/*.jpeg");   //不拦截的请求

        registry.addInterceptor(dataInterceptor)
                .excludePathPatterns("/**/*.css", "/**/*.js", "/**/*.png", "/**/*.pg", "/**/*.jpeg");   //不拦截的请求

    }



}
